Change write_bytes to write_text to preserve newlines #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, I had a problem using this plugin on Windows (Python 3.11). I noticed that after running a command that uses version substitution,
pyproject.toml
and other files were back to their original contents, but the newlines had been changed (from CRLF to LF), which causes Git to see it as modified. Runninggit add
on them detects that they are otherwise unchanged and doesn't stage them, but it is still a bit confusing.I was able to fix this by changing calls to
write_bytes
to instead usewrite_text
, which writes newlines using a platform specific convention ("universal newlines"), which I think is usually the preferred behavior. It could be that the calls towrite_bytes
were made for a reason that I'm not aware of, but if this is an acceptable change it would improve the user experience on Windows.Thanks!